#pragma once

#include <windows.h>

static unsigned int __stdcall threadFunction(void *);


class MyThread {
        friend unsigned int __stdcall threadFunction(void *);
public:
        MyThread();
        virtual ~MyThread();
        int start(void * = NULL);
        void * wait();
        void stop();
        void detach();
        static void sleep(unsigned int);

protected:
        virtual void * run(void *) = 0;

private:
        HANDLE threadHandle;
        bool started;
        bool detached;
        void * param;
        unsigned int threadID;
};

